﻿<KCtl:BaseUserControl x:Class="Kiva7.Pages.JournalEntriesControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                      xmlns:KCtl="clr-namespace:Kiva7.Controls"
                      xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                      mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480"
    KCtl:TiltEffect.IsTiltEnabled="True">

    <Grid>

        <TextBlock x:Name="NoJournalEntries"
                   HorizontalAlignment="Center"
                   Visibility="{Binding PagesCount, Converter={StaticResource numberNotVisibility}}"
                   Text="{Binding Path=L.ThereAreNoJournalEntries, Source={StaticResource L}}"/>
        
        <ListBox x:Name="lbxJournalEntries" Margin="6,0,-12,0" 
              Background="{StaticResource KivaBackgroundBrush}"
             ItemsSource="{Binding Data}" 
             HorizontalContentAlignment="Stretch" SelectionChanged="lbxJournalEntries_SelectionChanged"
                 Visibility="{Binding IsLoaded, Converter={StaticResource booleanToVisibility}}">

            <ListBox.ItemTemplate>

                <DataTemplate>

                    <KCtl:OrientedStackPanel Margin="0,0,0,18" Style="{StaticResource KivaListItemStyle}" WidthP="450" WidthL="612">

                        <TextBlock Text="{Binding Subject}" Style="{StaticResource KivaTextGroupHeaderStyle}" 
                               TextWrapping="Wrap" />

                        <TextBlock Text="{Binding Translation.Text, Converter={StaticResource tagStripperConverter}}" 
                                   Style="{StaticResource KivaTextNormalStyle}" 
                                    TextTrimming="WordEllipsis"
                                    TextWrapping="Wrap" 
                                    Height="60"/>
                        <toolkit:WrapPanel Orientation="Horizontal" >
                            <TextBlock Text="{Binding Date, Converter={StaticResource toShortDate}}" 
                               Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding Author}" Style="{StaticResource KivaTextAccentStyle}"/>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Path=L.Comments, Source={StaticResource L}}" 
                                       Style="{StaticResource KivaTextSmallStyle}"
                                       Visibility="{Binding CommentCount, Converter={StaticResource numberVisibility}}"/>
                                <TextBlock Text="{Binding CommentCount}" Style="{StaticResource KivaTextAccentStyle}"
                                       Visibility="{Binding CommentCount, Converter={StaticResource numberVisibility}}"
                                   Margin="12,0,0,0"/>
                            </StackPanel>
                        </toolkit:WrapPanel>

                    </KCtl:OrientedStackPanel>

                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</KCtl:BaseUserControl>
